package com.xfcy.blog.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.xfcy.blog.common.R;
import com.xfcy.blog.dto.JobDTO;
import com.xfcy.blog.entity.Job;
import com.xfcy.blog.exception.TaskException;
import org.quartz.SchedulerException;

import java.util.List;
import java.util.Map;

/**
 * 定时任务调度表(Job)表服务接口
 *
 * @author 晓风残月Lx
 * @since 2023-04-09 11:03:06
 */
public interface JobService extends IService<Job> {

    /**
     * 定时任务列表
     * @param pageNo
     * @param pageSize
     * @param jobName
     * @param jobGroup
     * @param status
     * @return
     */
    R listJob(Long pageNo, Long pageSize, String jobName, String jobGroup, String status);

    /**
     * 删除定时任务
     * @param jobId
     * @return
     */
    R deleteJob(Long jobId) throws SchedulerException;

    /**
     * 批量删除定时任务
     * @param ids
     * @return
     */
    R deleteBatchJob(List<Long> ids);

    /**
     * 获取定时任务详情
     * @param jobId
     * @return
     */
    R getJobById(Long jobId);

    /**
     * 修改定时任务
     * @param jobDTO
     * @return
     */
    R updateJob(JobDTO jobDTO) throws SchedulerException, TaskException;

    /**
     * 添加定时任务
     * @param jobDTO
     * @return
     */
    R addJob(JobDTO jobDTO) throws SchedulerException, TaskException;

    /**
     * 更改状态
     * @param jobDTO
     * @return
     */
    R changeStatus(JobDTO jobDTO) throws SchedulerException;

    /**
     *
     * @param job
     * @return
     */
    R run(Job job);

}


